package com.ruoyi.framework.web.domain;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.ruoyi.system.domain.vo.CustomerVo;

import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;

/**
 * Treeselect树结构实体类
 *
 * @author ruoyi
 */
public class CustomerTreeSelect implements Serializable
{
    private static final long serialVersionUID = 1L;

    /** 节点ID */
    private Long id;

    /** 节点名称 */
    private String name;

    /** 经销商权限 */
    private String customerType;

    /** 店仓数量 */
    private Integer storeCount;

    /** 子节点 */
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private List<CustomerTreeSelect> children;

    public CustomerTreeSelect()
    {

    }

    public CustomerTreeSelect(CustomerVo customer)
    {
        this.id = customer.getId();
        this.name = customer.getName();
        this.customerType = customer.getCustomerType();
        this.storeCount = customer.getStoreCount();
        this.children = customer.getChildren().stream().map(CustomerTreeSelect::new).collect(Collectors.toList());
    }

    public Long getId()
    {
        return id;
    }

    public void setId(Long id)
    {
        this.id = id;
    }

    public String getName()
    {
        return name;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    public String getCustomerType()
    {
        return customerType;
    }

    public void setCustomerType(String customerType)
    {
        this.customerType = customerType;
    }

    public Integer getStoreCount(){return storeCount;}

    public void setStoreCount(Integer storeCount)
    {
        this.storeCount = storeCount;
    }

    public List<CustomerTreeSelect> getChildren()
    {
        return children;
    }

    public void setChildren(List<CustomerTreeSelect> children)
    {
        this.children = children;
    }
}
